package com.lzq.his.controller;

import com.lzq.his.domain.User;
import com.lzq.his.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping
    public List<User> selectAll() {
        return userService.selectAll();
    }

    @PostMapping("/save")
    public void save(@RequestBody User user) {
        System.out.println(user);
        userService.save(user);
    }

    @DeleteMapping("/delete/{id}")
    public void deleteUser(@PathVariable String id) {
        userService.deleteById(id);
    }
}
